package com.fenghongzhang.day012;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class MyReceiver2 extends BroadcastReceiver {

    private static final String TAG = "MyReceiver2";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: ");

        String action = intent.getAction();
        if(action.equals("com.feng")){

        }else if(action.equals("com.tian2")){

        }

        String name = intent.getStringExtra("name");
        Log.i(TAG, "onReceive: "+name);

        Bundle extras = intent.getExtras();
        String name2 = extras.getString("name2");
        Log.i(TAG, "onReceive: "+name2);

        //判断是否有序
        if(isOrderedBroadcast()){
            abortBroadcast(); //终止广播
        }
    }
}
